<?php
 
//父类指向子类
abstract class Employee{
	abstract function continueToWork();
}
class Sales extends Employee{
	private function makeSalePlan(){
		echo "make sale plan";
	}

	public function continueToWork(){
		$this->makeSalePlan();
	}
}

class Market extends Employee{
	private function makeProductPrice(){
		echo "make product price";
	}

	public function continueToWork(){
		$this->makeProductPrice();
	}
}

class Engineer extends Employee{
	private function makeNewProduct(){
		echo "make new product";
	}

	public function continueToWork(){
		$this->makeNewProduct();
	}
}

class Demo{
	public function Work(Employee $employeeObj){//添加父类类型限制传参类型,使其满足多态第三点要求，父类指向子类
		$employeeObj->continueToWork();
	}
}
echo "abcd"; 

//调用
$obj = new Demo();
$obj->Work(new Sales());echo "<br>";
$obj->Work(new Market());echo "<br>";
$obj->Work(new Engineer());echo "<br>";
?>
 